home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Leonardo the Inventor
/
Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso
/
LEOWINMV
/
SHARED.DIR
/
03073_Script_BUTTON HANDLERS
< prev
next >
Wrap
Text File
|
1996-04-01
|
9KB
|
259 lines
-- -----------------------------------------------------------
-- Handler hiliteButton hilites the button that was clicked
-- and unhilites the button when the mouse button is released.
-- NOTE: THIS IS THE OLD VERSION: THAT HILITE THE BUTTON USING
-- CAST NAMES.
--on hiliteButton stopSound1Flag, stopSound2Flag
-- global hilitedButtonSprite, hilitedButtonOriginalCast
--
-- put the clickon into hilitedButtonSprite
-- put the castNum of sprite hilitedButtonSprite into hilitedButtonOriginalCast
-- put (the name of cast hilitedButtonOriginalCast) & " Hilited" into HilitedCastName
--
-- puppetSprite hilitedButtonSprite, true
-- set the castNum of sprite hilitedButtonSprite to the number of cast HilitedCastName
--
-- -- stopSound1Flag and stopSound2Flag were added because the music
-- -- in sound channel 2 were stopping:
-- -- 1) in the gallery movie when clicking the continue button
-- -- 2) when clicking the copy button
-- -- 3) when clicking the print button
-- -- (ie when clicking a button that stayed in the same movie and music was playing
-- -- in sound channel 2)
-- if voidP(stopSound1Flag) or (stopSound1Flag = 1) then sound stop 1
-- if voidP(stopSound2Flag) or (stopSound2Flag = 1) then sound stop 2
--
-- puppetTransition 0
-- updateStage
--
-- repeat while the mouseDown
-- nothing
-- end repeat
--
-- unhiliteButton
--end
-- NOTE: THIS IS THE NEW VERSION: THAT HILITE THE BUTTON USING
-- CAST NUMBERS.
on hiliteButton stopSound1Flag, stopSound2Flag
global hilitedButtonSprite, hilitedButtonOriginalCast
put the clickon into hilitedButtonSprite
put the castNum of sprite hilitedButtonSprite into hilitedButtonOriginalCast
set oldCastName = the name of cast hilitedButtonOriginalCast
set HilitedCastName = getHilitedCastNumber(oldCastName)
puppetSprite hilitedButtonSprite, true
set the castNum of sprite hilitedButtonSprite = HilitedCastName
-- stopSound1Flag and stopSound2Flag were added because the music
-- in sound channel 2 were stopping:
-- 1) in the gallery movie when clicking the continue button
-- 2) when clicking the copy button
-- 3) when clicking the print button
-- (ie when clicking a button that stayed in the same movie and music was playing
-- in sound channel 2)
if voidP(stopSound1Flag) or (stopSound1Flag = 1) then sound stop 1
if voidP(stopSound2Flag) or (stopSound2Flag = 1) then sound stop 2
puppetTransition 0
updateStage
repeat while the mouseDown
nothing
end repeat
unhiliteButton
end
-- -----------------------------------------------------------
-- Handler hiliteButtonKeepHilited hilites the button that was
-- clicked and does not unhilite the button.
-- NOTE: THIS IS THE OLD VERSION: THAT HILITE THE BUTTON USING
-- CAST NAMES.
--on hiliteButtonKeepHilited stopSound1Flag, stopSound2Flag
-- global hilitedButtonSprite, hilitedButtonOriginalCast
--
-- put the clickon into hilitedButtonSprite
-- put the castNum of sprite hilitedButtonSprite into hilitedButtonOriginalCast
-- put (the name of cast hilitedButtonOriginalCast) & " Hilited" into HilitedCastName
--
-- puppetSprite hilitedButtonSprite, true
-- set the castNum of sprite hilitedButtonSprite to the number of cast HilitedCastName
--
-- -- stopSound1Flag and stopSound2Flag were added because the music
-- -- in sound channel 2 were stopping:
-- -- 1) in the gallery movie when clicking the continue button
-- -- 2) when clicking the copy button
-- -- 3) when clicking the print button
-- -- (ie when clicking a button that stayed in the same movie and music was playing
-- -- in sound channel 2)
-- if voidP(stopSound1Flag) or (stopSound1Flag = 1) then sound stop 1
-- if voidP(stopSound2Flag) or (stopSound2Flag = 1) then sound stop 2
--
-- puppetTransition 0
-- updateStage
--end
-- NOTE: THIS IS THE NEW VERSION: THAT HILITE THE BUTTON USING
-- CAST NUMBERS.
on hiliteButtonKeepHilited stopSound1Flag, stopSound2Flag
global hilitedButtonSprite, hilitedButtonOriginalCast
put the clickon into hilitedButtonSprite
put the castNum of sprite hilitedButtonSprite into hilitedButtonOriginalCast
set oldCastName = the name of cast hilitedButtonOriginalCast
set HilitedCastName = getHilitedCastNumber(oldCastName)
puppetSprite hilitedButtonSprite, true
set the castNum of sprite hilitedButtonSprite to the number of cast HilitedCastName
-- stopSound1Flag and stopSound2Flag were added because the music
-- in sound channel 2 were stopping:
-- 1) in the gallery movie when clicking the continue button
-- 2) when clicking the copy button
-- 3) when clicking the print button
-- (ie when clicking a button that stayed in the same movie and music was playing
-- in sound channel 2)
if voidP(stopSound1Flag) or (stopSound1Flag = 1) then sound stop 1
if voidP(stopSound2Flag) or (stopSound2Flag = 1) then sound stop 2
puppetTransition 0
updateStage
end
-- -----------------------------------------------------------
-- Handler unhiliteButton unhilites the button that was clicked.
-- NOTE: THIS IS THE OLD VERSION: IT TAKES THE NUMBER OF CAST HILITEDBUTTONORIGINALCAST
-- WHEN THISVARIABLE IS ITSELF ALREADY A NUMBER
--on unhiliteButton
-- global hilitedButtonSprite, hilitedButtonOriginalCast
--
-- set the castNum of sprite hilitedButtonSprite = the number of cast hilitedButtonOriginalCast
-- puppetSprite hilitedButtonSprite, false
-- puppetTransition 0
-- updateStage
--end
-- NOTE: THIS IS THE NEW VERSION: IT USES HILITEDBUTTONORIGINALCAST
-- AS A NUMBER
on unhiliteButton
global hilitedButtonSprite, hilitedButtonOriginalCast
set the castNum of sprite hilitedButtonSprite = hilitedButtonOriginalCast
puppetSprite hilitedButtonSprite, false
puppetTransition 0
updateStage
end
-- -----------------------------------------------------------
-- Handler hiliteMe hilites the clicked button by changing the
-- button's cast to the given cast.
on hiliteMe HilitedCastName
put the clickon into whichSprite
put the castNum of sprite whichSprite into originalCast
set the castNum of sprite whichSprite to the number of cast HilitedCastName
updateStage
end
-- -----------------------------------------------------------
-- Handler getHilitedCastNumber returns the number of the cast
-- that is the hilited cast of the given unHilitedCatName.
on getHilitedCastNumber unHilitedCastName
global smallBtnNoScriptHilited
global greyBtnHilited
global smallBtnHilited
global largeButtonHilited
global mediumButtonHilite
global replayHilited
global greyPrintBtnHilited
global PrintBtnHilited
global CopyBtnHilited
global InventBtnHilited
global QuitBtnHilited
if (unHilitedCastName = "Small Btn NO SCRIPT") then
return smallBtnNoScriptHilited
else if (unHilitedCastName = "Grey btn") then
return greyBtnHilited
else if (unHilitedCastName = "Small Btn") then
return smallBtnHilited
else if (unHilitedCastName = "Large Button") then
return largeButtonHilited
else if (unHilitedCastName = "Medium Button") then
return mediumButtonHilite
else if (unHilitedCastName = "Replay") then
return replayHilited
else if (unHilitedCastName = "Grey Print btn") then
return greyPrintBtnHilited
else if (unHilitedCastName = "Print btn") then
return PrintBtnHilited
else if (unHilitedCastName = "Copy btn") then
return CopyBtnHilited
else if (unHilitedCastName = "Invent btn") then
return InventBtnHilited
else if (unHilitedCastName = "Quit btn") then
return QuitBtnHilited
else -- to work with the old method in cast something was left out
return the number of cast (unHilitedCastName && "Hilited")
end if
end
-- -----------------------------------------------------------
-- Handler clickedButton ???
on clickedButton whichSprite -- currently unused
waitCursor
end
-- -----------------------------------------------------------
-- Handler doClickContentsButton is called when the user clicks
-- the contents button (directory 4 change because both the sprite
-- script and the cast script are not performed in director 4 as
-- they are in director 3)
on doClickContentsButton
hiliteButton
goMain
end
-- -----------------------------------------------------------
-- Handler doClickIndexButton is called when the user clicks
-- the index button (directory 4 change because both the sprite
-- script and the cast script are not performed in director 4 as
-- they are in director 3)
on doClickIndexButton
hiliteButton
goIndex
end
-- -----------------------------------------------------------
-- Handler doClickHelpButton is called when the user clicks
-- the help button (directory 4 change because both the sprite
-- script and the cast script are not performed in director 4 as
-- they are in director 3)
on doClickHelpButton
hiliteButton
goHelp
end
-- -----------------------------------------------------------
-- Handler doClickQuitButton is called when the user clicks
-- the quit button (directory 4 change because both the sprite
-- script and the cast script are not performed in director 4 as
-- they are in director 3)
on doClickQuitButton
hiliteButton
doQuit
end